import { ExtractPropTypes } from 'vue'
import { ZIndex } from '../../config'

export const stickyProps = {
  /** 开启吸顶 */
  enabled: {
    type: Boolean,
    default: true
  },
  /** 吸顶距离 */
  top: {
    type: [String, Number],
    default: 0
  },
  /** 自定义顶部导航栏高度, 单位px */
  customNavbarHeight: {
    type: [String, Number],
    default: 0
  },
  /** zIndex */
  zIndex: {
    type: [String, Number],
    default: ZIndex.sticky
  },
  /** 吸顶标识 */
  index: {
    type: [String, Number],
    default: ''
  }
}
export type StickyProps = ExtractPropTypes<typeof stickyProps>

export const stickyEmits = {
  /** 吸顶事件 */
  fixed: (index: string | number) => typeof index === 'string' || typeof index === 'number',
  /** 脱离吸顶事件 */
  unfixed: (index: string | number) => typeof index === 'string' || typeof index === 'number',
}
export type StickyEmits = typeof stickyEmits
